package com.study.service;

import com.study.config.IdWorks;
import com.study.dao.DeptMapper;
import com.study.entity.Dept;
import com.study.entity.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * @author : zhuyanpeng.zhuyanpeng
 * @Description: :
 * @date :Create in  2019/9/11- 10:30
 * @Version: V1.0
 * @Modified By:
 **/
@Service
public class DeptService {
    @Autowired
    DeptMapper deptMapper;
    @Autowired
    LoggerService loggerService;

    public List<Dept> queryList() {
        return  deptMapper.queryList();
    }

    public void insert(Dept dept) {
         deptMapper.insert(dept);
    }

    public void save(Dept dept){
        this.insert(dept);
        Logger logger = new Logger();
        logger.setId(IdWorks.getId());
        logger.setUrl("test");
        logger.setDescription("测试3");
        logger.setHttpMethod("GET");
        logger.setClassName(this.getClass().getName());
        logger.setIpAddress("127.0.0.1");
        logger.setTime(1200L);
        logger.setCreateTime(new Date());
        loggerService.insert(logger);
    }
}
